// 主页模块
import request from '@/utils/request.js'

// 获取顶部分类数据
export const findHeadCategory = () => {
  return request({
    method: 'get',
    url: '/home/category/head'
  })
}

// 获取品牌数据,默认6条
export const findBrand = (limit = 6) => {
  return request({
    method: 'get',
    url: '/home/brand',
    data: { limit }
  })
}

// 获取轮播图
export const findBanner = () => {
  return request({
    method: 'get',
    url: '/home/banner'
  })
}

// 获取新鲜好物数据
export const findNew = () => {
  return request({
    method: 'get',
    url: 'home/new'
  })
}

// 人气推荐
export const findHot = () => {
  return request({
    method: 'get',
    url: 'home/hot'
  })
}

// 获取商品信息
export const findGoods = () => {
  return request({
    method: 'get',
    url: 'home/goods'
  })
}

// 获取最新专题
export const findSpecial = () => {
  return request({
    method: 'get',
    url: 'home/special'
  })
}

/**
 * 获取单个顶级分类信息
 * @param {String} id - 顶级分类ID
 */
export const findTopCategory = (id) => {
  return request({
    method: 'get',
    url: '/category',
    data: { id }
  })
}
